class MainPanel extends BasePanel {
	constructor() {
		super();
		this.skinName = "zSkins.MainPanelSkin";
	}
	public btnPop: eui.Button;
	public btnPack: eui.Button;
	public btnGet: eui.Button;
	public btnPost: eui.Button;

	public addEvent(): void {
		this.btnPop.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onClickPop, this);
		this.btnPack.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onClickPack, this);
		this.btnGet.addEventListener(egret.TouchEvent.TOUCH_TAP, this.getReq, this);
		this.btnPost.addEventListener(egret.TouchEvent.TOUCH_TAP, this.postReq, this);
	}

	public init(): void {
		// TODO 初始化操作
	}

	public freshen(): void {
		console.log("触发freshen");
		super.freshen();
	}

	private onClickPack(): void {
		PanelManager.openPack();
	}

	private onClickPop(): void {
		PanelManager.openPop();
	}

	public hide(): void {
		console.log("触发hide");
		super.hide();
	}

	public dispose(): void {
		console.log("触发dispose");
		super.dispose();
	}

	private getReq(): void {
		let url = "xxx?xx=xx";
		Network.get(url, this.resGet.bind(this));
	}

	private resGet(res): void {
		console.log("Get请求成功");
		console.log(res);
	}

	private postReq(): void {
		let url = "xxx";
		let param = {};
		Network.post(url, param, this.resPost.bind(this));
	}

	private resPost(res): void {
		console.log("Post请求成功");
		console.log(res);
	}
}